﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿﻿using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using Tower.Data;
using System;
using Tower.Object;


namespace WS.Battle
{
    public class GameSim: EditorWindow
    {
        ObjectHumen m_CurAnimal;
 
        public RuleDefine.ECamp m_Camp;
        

        public void CreateGUI()
        {


            VisualElement root = rootVisualElement;
            var container = new VisualElement();
            container.style.marginTop = 20;
            
            //container.Add(AddButton("加入一只", () =>
            //{
            //    m_CurAnimal = BattleFieldManager.Instance.AddNewHumen( m_Camp );
            //}));
            //container.Add(AddButton("点赞", () =>
            //{
            //    BattleFieldManager.Instance.AddVote(m_CurAnimal.GUID);
            //}));

            //container.Add(AddButton("击飞", () =>
            //{
            //    m_CurAnimal.DoBeHit(1);
            //}));

            //var hpField = new IntegerField("血量");
            //hpField.value = 10;
            //hpField.style.marginTop = 5;
            //container.Add(hpField);

            //container.Add(AddButton("大楼建造", () =>
            //{
            //    BattleFieldManager.Instance.ForEditor_AddBuilding(m_Camp, hpField.value);
            //}));
            ////container.Add(AddButton("随机角色死亡", () =>
            ////{
            ////    BattleFieldManager.Instance.ForEditor_Dead(m_Camp);
            ////}));

            //container.Add( AddTitle("礼物列表") );

            //var countField = new IntegerField("个数");
            //countField.value = 1;
            //countField.style.marginTop = 5;
            //container.Add(countField);

            //container.Add(AddButton("仙女棒(召唤)", () =>
            //{
            //    m_CurAnimal.DoUseSkill(GiftManager.EGiftType.FairyStaff, countField.value );
            //}));
            //container.Add(AddButton("能量药丸(搬运能力提升10倍)", () =>
            //{
            //    m_CurAnimal?.DoUseSkill(GiftManager.EGiftType.AbilityPill, countField.value);
            //}));
            //container.Add(AddButton("魔法镜(伤害提升10倍)", () =>
            //{
            //    m_CurAnimal?.DoUseSkill(GiftManager.EGiftType.MagicMirror, countField.value);
            //}));
            //container.Add(AddButton("能量电池(眩晕10秒,+建设度)", () =>
            //{
            //    m_CurAnimal?.DoUseSkill(GiftManager.EGiftType.Battery, countField.value);
            //}));
            //container.Add(AddButton("爱的爆炸(摧毁最高建筑,+建设度)", () =>
            //{
            //    m_CurAnimal?.DoUseSkill(GiftManager.EGiftType.LoveExplosion, countField.value);
            //})); 
            //container.Add(AddButton("神秘空头(20倍搬运，清除负面buf，加一层建筑，摧毁敌方一层)", () =>
            //{
            //    m_CurAnimal?.DoUseSkill(GiftManager.EGiftType.SecretAirdrop, countField.value);
            //}));
            
            root.Add(container);
        }
 
        VisualElement AddButton(string text, Action action)
        {
            var btn = new Button();
            btn.clicked += action;
            btn.text = text;
            btn.style.marginTop = 5;
            return btn;
        }
        VisualElement AddTitle(string text )
        {
            var title = new Label(text);
            title.style.fontSize = 20;
            title.style.unityFontStyleAndWeight = FontStyle.Bold;
            return title;
        }
    }
}
